package test1;

import java.util.Arrays;
import java.util.Comparator;

/**
 * 静态内部类
 */
public class StaticInnerClassDemo1 {
    public static void main(String[] args) {
        String[] names = {"huang","huangjin","huangjinsong"};
        Arrays.sort(names,new ByLength());
        System.out.println(Arrays.toString(names));
    }
    static class ByLength implements Comparator<String> {
        public int compare(String s1,String s2) {
            return s1.length() - s2.length();
        }
    }
}
